module top(clk, rst, ps2_clk, ps2_data, hex1, hex2);
  input clk;
  input rst;
  input ps2_clk, ps2_data;
  output [6:0] hex1;
  output [6:0] hex2;

  reg [7:0] data;
  reg nextdata_n;
  reg ready;
  reg overflow;

  always @(posedge clk) begin
    if (nextdata_n == 1'b0) begin
      nextdata_n <= 1'b1;
    end
    if (ready) begin
      nextdata_n <= 1'b0;
    end
  end

  ps2_keyboard my_keyboard(
    .clk(clk),
    .clrn(~rst),
    .ps2_clk(ps2_clk),
    .ps2_data(ps2_data),
    .nextdata_n(nextdata_n),
    .data(data),
    .ready(ready),
    .overflow(overflow)
  );

  bcd7seg bcd7seg1(data[3:0], hex1);
  bcd7seg bcd7seg2(data[7:4], hex2);

endmodule
